package com.isunland.managesystem.ui;

import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
import butterknife.BindView;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BaseMultiChoiceAdapter;
import com.isunland.managesystem.entity.ZTreeNode;
import java.util.ArrayList;
import java.util.Map;

/**
 * 对象功能:
 * 开发公司: 北京信普达系统工程有限公司
 * 开发人员: HuXiaoDan
 * 创建时间: 2017/6/9 17:32
 */
public class CarStatusListAdapter extends BaseMultiChoiceAdapter<ZTreeNode> {

  // Constructors
  public CarStatusListAdapter(Context context, ArrayList<ZTreeNode> objects,
      Map<ZTreeNode, Boolean> selects) {
    super(context, objects, selects);
  }

  class ViewHolder extends BaseViewHolder {
    @BindView(R.id.tv_type_name) TextView tvTypeName;
    @BindView(R.id.cb_type_name) CheckBox cbTypeName;

    ViewHolder(View view) {
      super(view);
    }

    @Override protected int setCheckBoxId() {
      return R.id.cb_type_name;
    }
  }

  @Override protected int getViewRootId() {
    return R.layout.adapter_type_list;
  }

  @NonNull @Override public BaseViewHolder initHolder(View convertView) {
    return new ViewHolder(convertView);
  }

  @Override protected void init(ZTreeNode item, BaseViewHolder holder, int position) {
    ((ViewHolder) holder).tvTypeName.setText(item != null ? item.getName() : "");
  }
}

